﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.UI.DataVisualization.Charting;
using System.Text;
using HZ.Supervise.Model;
using HZ.Supervise.Model.Enum;
using System.Drawing;

namespace HZ.Supervise.Web.Secondphase.Comparison
{
	public partial class ComparisonByPro : BasePage
	{
		DataTable dt = new DataTable();
		string[] pid;
		string timefrom;
		string timeto;
		string sid;
		string pids;

		protected void Page_Load(object sender, EventArgs e)
		{

			timefrom = Request["timefrom"].Trim();
			timeto = Request["timeto"].Trim();
			pid = Request["Pid"].Split(',');
			pids = Request["Pid"];
			sid = Request["sid"];

			if (!IsPostBack)
			{
				dataBind();

				BindChart();
			}
		}

		private string GetConditionByAreaid()
		{

			string areaid = CurrentAccount.GetUser().Org.Area.AreaID;

			string where = "";

			if (areaid != Constants.CURRENT_DEPLOY_AREAID)
			{

				if (areaid.Substring(4, 2).Equals("00"))
				{

					where = " and AreaId like '" + areaid.Substring(0, 4) + "%'";

				}
				else
				{

					where = " and AreaId = '" + areaid + "'";

				}
			}
			else
			{
				where = " and AreaId like '22%'";
			}

			return where;

		}

		/// <summary>
		/// 数据绑定
		/// </summary>
		public void dataBind()
		{

			HZ.Supervise.IBLL.IExecuteContext ie = HZ.Supervise.BLLFactory.ExecuteContext();

			string where = "";

			foreach (string item in pid)
			{
				if (!string.IsNullOrEmpty(item))
				{

					where += "'" + item + "',";

				}
			}

			where = " and ProcureCatalogID in(" + where.Remove(where.Length - 1, 1).ToString() + ")";
			if (string.IsNullOrEmpty(timefrom) || string.IsNullOrEmpty(timeto)) { }
			else
			{
				where += " and (" + this.timeto + ">=DayTime and DayTime>=" + this.timefrom + ")";
			}
			where += GetConditionByAreaid();

			System.Data.DataTable dt2 = ie.ExecutePro(where);

			dt = dt2.Copy();

			HZ.Supervise.Web.Function.ChangeRate(dt2, "DistributeRate", "addDistributeRate");

			HZ.Supervise.Web.Function.AddColumn(dt2, "WareHouseRate", "SortSource");

			gvwAreaComparison.DataSource = dt2;

			gvwAreaComparison.DataBind();

			HZ.Supervise.Web.Function.Combine(gvwAreaComparison);


		}

		public string getSortSource(object SortSource)
		{
			return HZ.Supervise.Web.Function.FormatDrugSourceByName(SortSource.ToString()).Trim();
		}

		protected void gvwProcureCatalog_RowDataBound(object sender, GridViewRowEventArgs e)
		{

		}

		protected void AspNetPager1_PageChanged(object sender, EventArgs e)
		{

		}

		protected void btnExcel_Click(object sender, EventArgs e)
		{
			HZ.Supervise.IBLL.IExecuteContext ie = HZ.Supervise.BLLFactory.ExecuteContext();

			string where = "";

			foreach (string item in pid)
			{
				if (!string.IsNullOrEmpty(item))
				{

					where += "'" + item + "',";

				}
			}

			where = " and ProcureCatalogID in(" + where.Remove(where.Length - 1, 1).ToString() + ")";
			if (string.IsNullOrEmpty(timefrom) || string.IsNullOrEmpty(timeto)) { }
			else
			{
				where += " and (" + this.timeto + ">=DayTime and DayTime>=" + this.timefrom + ")";
			}
			where += GetConditionByAreaid();
			System.Data.DataTable dt2 = ie.ExecutePro(where);

			dt = dt2.Copy();

			HZ.Supervise.Web.Function.ChangeRate(dt2, "DistributeRate", "addDistributeRate");

			HZ.Supervise.Web.Function.AddColumn(dt2, "WareHouseRate", "SortSource");

			HZ.Excel.ExcelHelper.ExportDataForWeb(dt2, this.gvwAreaComparison);

		}

		protected void btn2_Click(object sender, EventArgs e)
		{
			Response.Redirect("ComparisonByProSettlement.aspx?Pid2=" + pids + "&timefrom2=" + timefrom + "&timeto2=" + timeto);
		}

		#region 图表绑定 董辉 修改 2011-4-9 14:29

		/// <summary>
		/// 绑定金额与数量的图表数据
		/// 董辉
		/// 2011-4-9 14:20
		/// </summary>
		private void BindChart()
		{
			#region 变量

			//用于排序后的新的数据集合
			DataTable NewDatatable = new DataTable();

			//基本药物目录循环因子
			int BaseI = 0;

            ////补充目录循环因子
            int ComplementI = 0;

            //2010基本药物目录循环因子
            int Base_2010I = 0;

            //2010限价品种循环因子
            int PriceFixing_2010I = 0;

            //2010补充目录循环因子
            int Complementarity_2010I = 0;

			//医院名称
			string ProductName = string.Empty;

			#endregion

			#region 将datatable按医院名称进行排序

			//声明dataview对象，并把dt传给dataview
			DataView dv = dt.DefaultView;

			//指定dataview按中文进行排序
			dv.Table.Locale = new System.Globalization.CultureInfo("zh-CN");

			//排序条件为医院
			dv.Sort = " ProductName desc ";

			//排序后的集合传给新的datatable
			NewDatatable = dv.ToTable();

			#endregion

			#region 构造序列集

			#region 采购金额序列集

			/***********************************************************************************************/

			//2010基本药物目录采购金额序列
            Series BasicCatalog_2010_Money = new Series("日常采购");

			//设置图表类型为柱状图
			BasicCatalog_2010_Money.ChartType = SeriesChartType.Column;

			BasicCatalog_2010_Money.MarkerStyle = MarkerStyle.Diamond;

			//设置图表边宽
			BasicCatalog_2010_Money.BorderWidth = 1;

			//设置图表偏移量
			BasicCatalog_2010_Money.ShadowOffset = 1;

			//画图类型
			//   BasicCatalog_2010_Money["DrawingStyle"] = "Cylinder";

			

            /***********************************************************************************************/

            //2010限价品种采购金额序列
            Series PriceFixing_2010_Money = new Series("临时采购");

            //设置图表类型为柱状图
            PriceFixing_2010_Money.ChartType = SeriesChartType.Column;
            PriceFixing_2010_Money.MarkerStyle = MarkerStyle.Diamond;
            //PriceFixing_2010_Money.Color = Color.Blue;

            //设置图表边宽
            PriceFixing_2010_Money.BorderWidth = 1;

            //设置图表偏移量
            PriceFixing_2010_Money.ShadowOffset = 1;

            //画图类型
            // PriceFixing_2010_Money["DrawingStyle"] = "Cylinder";

            /***********************************************************************************************/

            //2010补充目录采购金额序列
            Series ComplementarityCatalog_2010_Money = new Series("应急采购");

            //设置图表类型为柱状图
            ComplementarityCatalog_2010_Money.ChartType = SeriesChartType.Column;
            ComplementarityCatalog_2010_Money.MarkerStyle = MarkerStyle.Diamond;
            //ComplementarityCatalog_2010_Money.Color = Color.Red;

            //设置图表边宽
            ComplementarityCatalog_2010_Money.BorderWidth = 1;

            //设置图表偏移量
            ComplementarityCatalog_2010_Money.ShadowOffset = 1;

            //画图类型

            BasicCatalog_2010_Money.Label = "#VAL{F}";
            BasicCatalog_2010_Money.Color = Color.FromArgb(74, 172, 197);

            PriceFixing_2010_Money.Label = "#VAL{F}";
            PriceFixing_2010_Money.Color = Color.FromArgb(129, 101, 162);
            ComplementarityCatalog_2010_Money.Label = "#VAL{F}";
            ComplementarityCatalog_2010_Money.Color = Color.FromArgb(192, 80, 78);
			#endregion



			//2010基本药物配送率序列
            Series BasicCatalog_2010_PSRate = new Series("日常采购");

			//设置图表类型为柱状图
			BasicCatalog_2010_PSRate.ChartType = SeriesChartType.Column;

			BasicCatalog_2010_PSRate.Color = Color.DarkGray;

			//设置图表边宽
			BasicCatalog_2010_PSRate.BorderWidth = 1;

			//设置图表偏移量
			BasicCatalog_2010_PSRate.ShadowOffset = 1;

			BasicCatalog_2010_PSRate.IsValueShownAsLabel = true;

			BasicCatalog_2010_PSRate.Color = Color.FromArgb(74, 172, 197);
            /***********************************************************************************************/

            //2010限价品种配送率序列
            Series PriceFixing_2010_PSRate = new Series("临时采购");

            //设置图表类型为柱状图
            PriceFixing_2010_PSRate.ChartType = SeriesChartType.Column;

            //设置图表边宽
            PriceFixing_2010_PSRate.BorderWidth = 1;

            //设置图表偏移量
            PriceFixing_2010_PSRate.ShadowOffset = 1;

            PriceFixing_2010_PSRate.IsValueShownAsLabel = true;

            PriceFixing_2010_PSRate.Color = Color.FromArgb(129, 101, 162);

            /***********************************************************************************************/

            //2010补充药品配送率序列
            Series ComplementarityCatalog_2010_PSRate = new Series("应急采购");

            //设置图表类型为柱状图
            ComplementarityCatalog_2010_PSRate.ChartType = SeriesChartType.Column;

            //设置图表边宽
            ComplementarityCatalog_2010_PSRate.BorderWidth = 1;

            //设置图表偏移量
            ComplementarityCatalog_2010_PSRate.ShadowOffset = 1;

            ComplementarityCatalog_2010_PSRate.IsValueShownAsLabel = true;

            ComplementarityCatalog_2010_PSRate.Color = Color.FromArgb(192, 80, 78);

			#endregion

			#region 给序列集绑定数据

			HZ.Supervise.Web.Function.ChangeRate(NewDatatable, "DistributeRate", "addDistributeRate");

			HZ.Supervise.Web.Function.AddColumn(NewDatatable, "WareHouseRate", "SortSource");
			//如果数据源不为空同时又存在数据
			if (NewDatatable != null && NewDatatable.Rows.Count > 0)
			{
				for (int i = 0; i < NewDatatable.Rows.Count; i++)
				{
					//如果为第一行，就初始化图表序列集合
					if (i == 0)
					{
						//获取第一行中的医院名称
						ProductName = NewDatatable.Rows[0]["ProductName"].ToString();

						#region 初始化

						//根据SortSource采购类型来绑定序列集合的数据
						switch (NewDatatable.Rows[0]["SortSource"].ToString())
						{


                            //2010基本药物
                            case "0":

                                //初始化采购类型为3的序列集
                                InitBindChart(NewDatatable.Rows[0],
                                              "0",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                              PriceFixing_2010I,
                                              Complementarity_2010I,
                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,
                                BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;

                            //2010限价品种
                            case "1":

                                //初始化采购类型为5的序列集
                                InitBindChart(NewDatatable.Rows[0],
                                              "1",
                                    //BaseI,
                                    //ComplementI,
                                              Base_2010I,
                                              PriceFixing_2010I,
                                              Complementarity_2010I,
                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,

                                BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;

                            //2010补充药品
                            case "2":

                                //初始化采购类型为6的序列集
                                InitBindChart(NewDatatable.Rows[0],
                                              "2",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                              PriceFixing_2010I,
                                              Complementarity_2010I,

                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,

                                BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;
						}

						#endregion

						//BaseI++;

                        //ComplementI++;

                        Base_2010I++;

                        PriceFixing_2010I++;

                        Complementarity_2010I++;

						//跳过下边的语句重新循环
						continue;
					}

					//不为第一行数据
					//如果当前行的医院名称与上一行中的名称相同
					if (NewDatatable.Rows[i]["ProductName"].ToString().Equals(ProductName))
					{
						#region 绑定序列集合

						switch (NewDatatable.Rows[i]["SortSource"].ToString())
						{

                            //2010基本药物
                            case "0":

                                FinishBindChart(NewDatatable.Rows[i],
                                                "0",
                                                //BaseI,
                                                //ComplementI,
                                                Base_2010I,
                                                PriceFixing_2010I,
                                                Complementarity_2010I,
                                                BasicCatalog_2010_Money,
                                                PriceFixing_2010_Money,
                                                ComplementarityCatalog_2010_Money,

                                BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;

                            //2010限价品种
                            case "1":

                                FinishBindChart(NewDatatable.Rows[i],
                                                "1",
                                                //BaseI,
                                                //ComplementI,
                                                Base_2010I,
                                                PriceFixing_2010I,
                                                Complementarity_2010I,
                                                BasicCatalog_2010_Money,
                                                PriceFixing_2010_Money,
                                                ComplementarityCatalog_2010_Money,
                            BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;

                            //2010补充药品
                            case "2":

                                FinishBindChart(NewDatatable.Rows[i],
                                                "2",
                                                //BaseI,
                                                //ComplementI,
                                                Base_2010I,
                                                PriceFixing_2010I,
                                                Complementarity_2010I,
                                                BasicCatalog_2010_Money,
                                                PriceFixing_2010_Money,
                                                ComplementarityCatalog_2010_Money,

                                BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;
						}

						#endregion

						//把当前行的医院名称重新赋值给变量
						ProductName = NewDatatable.Rows[i]["ProductName"].ToString();
					}
					else
					{
						#region 初始化

						//根据SortSource采购类型来绑定序列集合的数据
						switch (NewDatatable.Rows[i]["SortSource"].ToString())
						{
                            //2010基本药物
                            case "0":

                                //初始化采购类型为3的序列集
                                InitBindChart(NewDatatable.Rows[i],
                                              "0",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                              PriceFixing_2010I,
                                              Complementarity_2010I,

                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,

BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;

                            //2010限价品种
                            case "1":

                                //初始化采购类型为5的序列集
                                InitBindChart(NewDatatable.Rows[i],
                                              "1",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                              PriceFixing_2010I,
                                              Complementarity_2010I,

                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,

                            BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;

                            //2010补充药品
                            case "2":

                                //初始化采购类型为6的序列集
                                InitBindChart(NewDatatable.Rows[i],
                                              "2",
                                              //BaseI,
                                              //ComplementI,
                                              Base_2010I,
                                              PriceFixing_2010I,
                                              Complementarity_2010I,

                                              BasicCatalog_2010_Money,
                                              PriceFixing_2010_Money,
                                              ComplementarityCatalog_2010_Money,

                            BasicCatalog_2010_PSRate,
                                PriceFixing_2010_PSRate,
                                ComplementarityCatalog_2010_PSRate);
                                break;

						}

						#endregion

						//把当前行的医院名称重新赋值给变量
						ProductName = NewDatatable.Rows[i]["ProductName"].ToString();

						//BaseI++;

                        //ComplementI++;

                        Base_2010I++;

                        PriceFixing_2010I++;

                        Complementarity_2010I++;
					}
				}

				//提示按钮隐藏
				this.lblnull.Visible = false;

				#region 金额序列集合加入金额图表中

                //2010基本药物采购金额加入图表中
                BasicCatalog_2010_Money.IsValueShownAsLabel = true;
                ChartPurchasing.Series.Add(BasicCatalog_2010_Money);
                ChartPurchasing.Series["日常采购"].ChartArea = "ChartProPurchasing";

                //2010限价品种采购金额序列
                PriceFixing_2010_Money.IsValueShownAsLabel = true;
                ChartPurchasing.Series.Add(PriceFixing_2010_Money);
                ChartPurchasing.Series["临时采购"].ChartArea = "ChartProPurchasing";

                //2010补充药品采购金额序列
                PriceFixing_2010_Money.IsValueShownAsLabel = true;
                ChartPurchasing.Series.Add(ComplementarityCatalog_2010_Money);
                ChartPurchasing.Series["应急采购"].ChartArea = "ChartProPurchasing";


				#endregion
                this.ChartInStorage.Series.Add(BasicCatalog_2010_PSRate);

                this.ChartInStorage.Series.Add(PriceFixing_2010_PSRate);

                this.ChartInStorage.Series.Add(ComplementarityCatalog_2010_PSRate);

                this.ChartInStorage.Series["日常采购"].ChartArea = "ChartProStorage";

                this.ChartInStorage.Series["临时采购"].ChartArea = "ChartProStorage";

                this.ChartInStorage.Series["应急采购"].ChartArea = "ChartProStorage";


				ChartInStorage.ChartAreas["ChartProStorage"].AxisX.IsMarginVisible = true;

				ChartInStorage.ChartAreas["ChartProStorage"].AxisX.LabelStyle.Font = new Font("宋体", 8);

				ChartInStorage.ChartAreas["ChartProStorage"].Area3DStyle.Enable3D = false;

                ChartInStorage.Series["日常采购"]["PointWidth"] = "0.5";
                ChartInStorage.Series["临时采购"]["PointWidth"] = "0.5";
                ChartInStorage.Series["应急采购"]["PointWidth"] = "0.5";

				ChartInStorage.ChartAreas["ChartProStorage"].AxisX.MajorGrid.Interval = 1;

				ChartInStorage.ChartAreas["ChartProStorage"].AxisX.LineWidth = 1;

				ChartInStorage.ChartAreas["ChartProStorage"].AxisY.LineWidth = 1;

				ChartInStorage.ChartAreas["ChartProStorage"].AxisY.Title = "配送率";

				ChartInStorage.ChartAreas["ChartProStorage"].AxisX.Title = "药品";

				//#endregion

				#region 图表属性设置

				ChartPurchasing.ChartAreas["ChartProPurchasing"].AxisX.IsMarginVisible = true;
				ChartPurchasing.ChartAreas["ChartProPurchasing"].AxisX.LabelStyle.Font = new Font("宋体", 8);
				ChartPurchasing.ChartAreas["ChartProPurchasing"].Area3DStyle.Enable3D = false;

                ChartPurchasing.Series["日常采购"]["PointWidth"] = "0.5";
                ChartPurchasing.Series["临时采购"]["PointWidth"] = "0.5";
                ChartPurchasing.Series["应急采购"]["PointWidth"] = "0.5";


				ChartPurchasing.ChartAreas["ChartProPurchasing"].AxisX.MajorGrid.Interval = 1;
				ChartPurchasing.ChartAreas["ChartProPurchasing"].AxisX.LineWidth = 1;
				ChartPurchasing.ChartAreas["ChartProPurchasing"].AxisY.LineWidth = 1;


				ChartPurchasing.ChartAreas["ChartProPurchasing"].AxisY.Title = "金额（万元）";
				ChartPurchasing.ChartAreas["ChartProPurchasing"].AxisX.Title = "药品";
				#endregion
			}
			else
			{
				//隐藏金额图表
				this.ChartPurchasing.Visible = false;

                this.divTable.Visible = false;

                this.btnExcel.Visible = false;

                //提示按钮显示出来
				lblnull.Visible = true;
			}

			#endregion
		}

		/// <summary>
		/// 第一次绑定序列集合
		/// 董辉
		/// 2011-4-9 17:11
		/// </summary>
		/// <param name="row">当前行数据</param>
		/// <param name="ParameType">采购类型</param>
		/// <param name="BaseI">基本药品目录循环因子</param>
		/// <param name="ComplementI">补充目录循环因子</param>
		/// <param name="Base_2010I">2010基本药物循环因子</param>
		/// <param name="PriceFixing_2010I">2010限价品种循环因子</param>
		/// <param name="Complementarity_2010I">2010补充药品循环因子</param>
		/// <param name="BasicCatalog_Money">基本药物目录采购金额序列</param>
		/// <param name="ComplementarityCatalog_Money">补充目录采购金额序列</param>
		/// <param name="BasicCatalog_2010_Money">2010基本药物采购金额序列</param>
		/// <param name="PriceFixing_2010_Money">2010限价品种采购金额序列</param>
		/// <param name="ComplementarityCatalog_2010_Money">2010补充药品采购金额序列</param>
		/// <param name="BasicCatalog_Count">基本药物目录配送率序列</param>
		/// <param name="ComplementarityCatalog_Count">补充目录配送率序列</param>
		/// <param name="BasicCatalog_2010_Count">2010基本药物配送率序列</param>
		/// <param name="PriceFixing_2010_Count">2010限价品种配送率序列</param>
		/// <param name="ComplementarityCatalog_2010_Count">2010补充药品配送率序列</param>
		private void InitBindChart(DataRow row,
								   string ParameType,
                                   //int BaseI,
                                   //int ComplementI,
								   int Base_2010I,
                                   int PriceFixing_2010I,
                                   int Complementarity_2010I,

                                   Series BasicCatalog_2010_Money,
                                   Series PriceFixing_2010_Money,
                                   Series ComplementarityCatalog_2010_Money,

        Series BasicCatalog_2010_Count,
        Series PriceFixing_2010_Count,
        Series ComplementarityCatalog_2010_Count)
		{
			if (row != null)
			{
				switch (ParameType)
				{

                    //日常采购
					case "0":


                        //第一批基本药物目录采购金额序列
						BasicCatalog_2010_Money.Points.AddXY(row["ProductName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        BasicCatalog_2010_Money.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购采购金额：{1}", row["ProductName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");

                        //第一批基本药物目录配送率序列
						BasicCatalog_2010_Count.Points.AddXY(row["ProductName"].ToString(), row["DistributeRate"].ToString());
                        BasicCatalog_2010_Count.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购配送率：{1}", row["ProductName"].ToString(), row["addDistributeRate"].ToString());
                        //2010限价品种采购金额序列
                        PriceFixing_2010_Money.Points.AddXY(row["ProductName"].ToString(), 0);
                        PriceFixing_2010_Money.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购采购金额：{1}", row["ProductName"].ToString(), "0 万元");

                        ////2010限价品种配送率序列
                        PriceFixing_2010_Count.Points.AddXY(row["ProductName"].ToString(), 0);
                        PriceFixing_2010_Count.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购配送率：{1}", row["ProductName"].ToString(), "0%");

                        //2010补充目录采购金额序列
                        ComplementarityCatalog_2010_Money.Points.AddXY(row["ProductName"].ToString(), 0);
                        ComplementarityCatalog_2010_Money.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购采购金额：{1}", row["ProductName"].ToString(), "0 万元");

                        //2010补充目录配送率序列
                        ComplementarityCatalog_2010_Count.Points.AddXY(row["ProductName"].ToString(), 0);
                        ComplementarityCatalog_2010_Count.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购配送率：{1}", row["ProductName"].ToString(), "0%");

						break;

                    //临时采购
                    case "1":

                        //2010基本药物目录采购金额序列
                        BasicCatalog_2010_Money.Points.AddXY(row["ProductName"].ToString(), 0);
                        BasicCatalog_2010_Money.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购采购金额：{1}", row["ProductName"].ToString(), "0 万元");

                        //2010基本药物目录配送率序列
                        BasicCatalog_2010_Count.Points.AddXY(row["ProductName"].ToString(), 0);
                        BasicCatalog_2010_Count.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购配送率：{1}", row["ProductName"].ToString(), "0%");

                        //2010限价品种采购金额序列
                        PriceFixing_2010_Money.Points.AddXY(row["ProductName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        PriceFixing_2010_Money.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购采购金额：{1}", row["ProductName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");


                        ////2010限价品种配送率序列
                        PriceFixing_2010_Count.Points.AddXY(row["ProductName"].ToString(), row["DistributeRate"].ToString());
                        PriceFixing_2010_Count.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购配送率：{1}", row["ProductName"].ToString(), row["addDistributeRate"].ToString());

                        //2010补充目录采购金额序列
                        ComplementarityCatalog_2010_Money.Points.AddXY(row["ProductName"].ToString(), 0);
                        ComplementarityCatalog_2010_Money.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购采购金额：{1}", row["ProductName"].ToString(), "0 万元");

                        ////2010补充目录配送率序列
                        ComplementarityCatalog_2010_Count.Points.AddXY(row["ProductName"].ToString(), 0);
                        ComplementarityCatalog_2010_Count.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购配送率：{1}", row["ProductName"].ToString(), "0%");

                        break;

                    //应急采购
                    case "2":
                        //2010基本药物目录采购金额序列
                        BasicCatalog_2010_Money.Points.AddXY(row["ProductName"].ToString(), 0);
                        BasicCatalog_2010_Money.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购采购金额：{1}", row["ProductName"].ToString(), "0 万元");

                        //2010基本药物目录配送率序列
                        BasicCatalog_2010_Count.Points.AddXY(row["ProductName"].ToString(), 0);
                        BasicCatalog_2010_Count.Points[Base_2010I].ToolTip = string.Format("{0}\n日常采购配送率：{1}", row["ProductName"].ToString(), "0%");

                        //2010限价品种采购金额序列
                        PriceFixing_2010_Money.Points.AddXY(row["ProductName"].ToString(), 0);
                        PriceFixing_2010_Money.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购采购金额：{1}", row["ProductName"].ToString(), "0 万元");

                        //2010限价品种配送率序列
                        PriceFixing_2010_Count.Points.AddXY(row["ProductName"].ToString(), 0);
                        PriceFixing_2010_Count.Points[PriceFixing_2010I].ToolTip = string.Format("{0}\n临时采购配送率：{1}", row["ProductName"].ToString(), "0%");

                        //2010补充目录采购金额序列
                        ComplementarityCatalog_2010_Money.Points.AddXY(row["ProductName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        ComplementarityCatalog_2010_Money.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购采购金额：{1}", row["ProductName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");


                        //2010补充目录配送率序列
                        ComplementarityCatalog_2010_Count.Points.AddXY(row["ProductName"].ToString(), row["DistributeRate"].ToString());
                        ComplementarityCatalog_2010_Count.Points[Complementarity_2010I].ToolTip = string.Format("{0}\n应急采购配送率：{1}", row["ProductName"].ToString(), row["addDistributeRate"].ToString());

                        break;

				}
			}
		}


		/// <summary>
		/// 最终绑定序列集合
		/// 董辉
		/// 2011-4-9 17:21
		/// </summary>
		/// <param name="row">当前行数据</param>
		/// <param name="ParameType">采购类型</param>
		/// <param name="BaseI">基本药品目录循环因子</param>
		/// <param name="ComplementI">补充目录循环因子</param>
		/// <param name="Base_2010I">2010基本药物目录循环因子</param>
		/// <param name="PriceFixing_2010I">2010限价品种循环因子</param>
		/// <param name="Complementarity_2010I">2010补充目录循环因子</param>
		/// <param name="BasicCatalog_Money">基本药物目录采购金额序列</param>
		/// <param name="ComplementarityCatalog_Money">补充目录采购金额序列</param>
		/// <param name="BasicCatalog_2010_Money">2010基本药物目录采购金额序列</param>
		/// <param name="PriceFixing_2010_Money">2010限价品种采购金额序列</param>
		/// <param name="ComplementarityCatalog_2010_Money">2010补充目录采购金额序列</param>
		/// <param name="BasicCatalog_Count">基本药物目录配送率序列</param>
		/// <param name="ComplementarityCatalog_Count">补充目录配送率序列</param>
		/// <param name="BasicCatalog_2010_Count">2010基本药物目录配送率序列</param>
		/// <param name="PriceFixing_2010_Count">//2010限价品种配送率序列</param>
		/// <param name="ComplementarityCatalog_2010_Count">2010补充目录配送率序列</param>
		private void FinishBindChart(DataRow row,
									 string ParameType,
                                     //int BaseI,
                                     //int ComplementI,
									 int Base_2010I,
                                     int PriceFixing_2010I,
                                     int Complementarity_2010I,

                                     Series BasicCatalog_2010_Money,
                                     Series PriceFixing_2010_Money,
                                     Series ComplementarityCatalog_2010_Money,

        Series BasicCatalog_2010_Count,
        Series PriceFixing_2010_Count,
        Series ComplementarityCatalog_2010_Count)
		{
			if (row != null)
			{
				switch (ParameType)
				{


                    //日常采购
					case "0":

                        //上次绑定的第一批基本药物目录采购金额数据移除，重新绑定新的数据
						BasicCatalog_2010_Money.Points.RemoveAt(Base_2010I - 1);
                        //第一批基本药物目录采购金额序列
						BasicCatalog_2010_Money.Points.AddXY(row["ProductName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        BasicCatalog_2010_Money.Points[Base_2010I - 1].ToolTip = string.Format("{0}\n日常采购采购金额：{1}", row["ProductName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + "万元");


						//上次绑定的2010基本药物目录配送率数据移除，重新绑定新的数据
						BasicCatalog_2010_Count.Points.RemoveAt(Base_2010I - 1);
						//2010基本药物目录配送率序列
						BasicCatalog_2010_Count.Points.AddXY(row["ProductName"].ToString(), row["DistributeRate"].ToString());
                        BasicCatalog_2010_Count.Points[Base_2010I - 1].ToolTip = string.Format("{0}\n日常采购配送率：{1}", row["ProductName"].ToString(), row["addDistributeRate"].ToString() + " 个");

						break;

                    //临时采购
                    case "1":

                        //上次绑定的2010限价品种采购金额数据移除，重新绑定新的数据
                        PriceFixing_2010_Money.Points.RemoveAt(PriceFixing_2010I - 1);
                        //2010限价品种采购金额序列
                        PriceFixing_2010_Money.Points.AddXY(row["ProductName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        PriceFixing_2010_Money.Points[PriceFixing_2010I - 1].ToolTip = string.Format("{0}\n临时采购采购金额：{1}", row["ProductName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");

                        //上次绑定的2010限价品种配送率数据移除，重新绑定新的数据
                        PriceFixing_2010_Count.Points.RemoveAt(PriceFixing_2010I - 1);
                        //2010限价品种配送率序列
                        PriceFixing_2010_Count.Points.AddXY(row["ProductName"].ToString(), row["DistributeRate"].ToString());
                        PriceFixing_2010_Count.Points[PriceFixing_2010I - 1].ToolTip = string.Format("{0}\n临时采购配送率：{1}", row["ProductName"].ToString(), row["addDistributeRate"].ToString() + " 个");

                        break;

                    //应急采购
                    case "2":

                        //上次绑定的2010补充目录采购金额数据移除，重新绑定新的数据
                        ComplementarityCatalog_2010_Money.Points.RemoveAt(Complementarity_2010I - 1);
                        //2010补充目录采购金额序列
                        ComplementarityCatalog_2010_Money.Points.AddXY(row["ProductName"].ToString(), Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000);
                        ComplementarityCatalog_2010_Money.Points[Complementarity_2010I - 1].ToolTip = string.Format("{0}\n应急采购采购金额：{1}", row["ProductName"].ToString(), (Convert.ToDecimal(row["PurchaseAmountTotal"].ToString()) / 10000).ToString() + " 万元");


                        //上次绑定的2010补充目录配送率数据移除，重新绑定新的数据
                        ComplementarityCatalog_2010_Count.Points.RemoveAt(Complementarity_2010I - 1);
                        //2010补充目录配送率序列
                        ComplementarityCatalog_2010_Count.Points.AddXY(row["ProductName"].ToString(), row["DistributeRate"].ToString());
                        ComplementarityCatalog_2010_Count.Points[Complementarity_2010I - 1].ToolTip = string.Format("{0}\n应急采购配送率：{1}", row["ProductName"].ToString(), row["addDistributeRate"].ToString() + " 个");

                        break;

					
				}
			}
		}

		#endregion

		
	}
}
